package server

import (
	"net/http"
	"net/url"
)

type Context struct {
	Uid  int
	Args url.Values
	Http *ContextHttp
}

type ContextHttp struct {
	ResponseWriter http.ResponseWriter
	Request        *http.Request
}

func (c *Context) HasPermission(perm string) bool {
	return checkUserPerm(c.Uid, perm)
}

func (c *Context) HasNotAdminPermission(perm string) bool {
	return !isAdmin(c.Uid) && checkUserPerm(c.Uid, perm)
}